package com.app.data;

public class JavaFile {

	private String path;
	private Project project;
	private String name;
	private String formatName;
	
	public JavaFile(Project pro, String path) {
		this.path = path;
		this.project = pro;
		
		getFileName();
	}
	
	private void getFileName() {
		String pathTemp = path.replaceAll("\\\\", "/");
		String srcTemp = project.getSrcPath().replaceAll("\\\\", "/");
		String temp = pathTemp.replace(srcTemp, "");
		
		formatName = temp.replaceAll("/", ".");
		
		String[] s = pathTemp.split("/");
		name = s[s.length - 1];
	}
	
	public String getFormatName() {
		return formatName;
	}
	
	public String getName() {
		return name;
	}
	
	public Project getProject() {
		return project;
	}
	
	public String toString() {
		return name;
	}
}
